﻿// See https://aka.ms/new-console-template for more information
using QskjBaseDataToDb.Service;

Console.WriteLine("Hello, World!");

//Task.Factory.StartNew(() =>
//{

//    //CarDataUpdate.UpdateCarData();//锐明出租车
//    //CarDriverDataUpdate.UpdateCarData();//锐明驾驶员
//    //ZtCarDataUpdate.UpdateCarData();//中台出租车
//    //ZtCarDataUpdate.UpdateDriverData();//中台出租车的驾驶员
//    //ZtCarDataUpdate.UpdateCarDriverData();//中台出租车驾驶员排班
//    //ZakjBusDataUpdate.UpdateCarData();//中安大巴车
////ZtCarDataUpdate.ZtBusLeaseRecordData();//中台大巴车租赁数据
////ZtCarDataUpdate.ZtBusDriverData();//中台大巴车驾驶员
////ZtCarDataUpdate.ZtBusDriverBindData();//中台大巴车驾驶员绑定数据
////ZtCarDataUpdate.ZtBusData();//中台大巴车数据
//    Thread.Sleep(1000 * 3600);
//});
#region 出租车锐明车辆信息，驾驶员信息同步
ParameterizedThreadStart threadStart1 = new((obj) =>
{
    CarDataUpdate.UpdateCarData();//锐明出租车
    while (true)
    {
        if (DateTime.Now.Hour >= 2 && DateTime.Now.Hour < 4)
        {
            Console.WriteLine(DateTime.Now + "____锐明出租车数据同步执行开始");
            CarDataUpdate.UpdateCarData();//锐明出租车
            Thread.Sleep(1000 * 60 * 30);
        }
        Thread.Sleep(1000);
    }
});
Thread thread1 = new Thread(threadStart1);
thread1.Start();
ParameterizedThreadStart threadStart2 = new((obj) =>
{
    CarDriverDataUpdate.UpdateCarData();//锐明驾驶员
    while (true)
    {
        if (DateTime.Now.Hour >= 2 && DateTime.Now.Hour < 4)
        {
            Console.WriteLine(DateTime.Now + "____锐明驾驶员数据同步执行开始");
            CarDriverDataUpdate.UpdateCarData();//锐明驾驶员
            Thread.Sleep(1000 * 60 * 30);
        }
        Thread.Sleep(1000);
    }
});
Thread thread2 = new Thread(threadStart2);
thread2.Start();
#endregion
#region 大巴车中安车辆信息数据同步
ParameterizedThreadStart threadStart6 = new((obj) =>
{
    ZakjBusDataUpdate.UpdateCarData();//中安大巴车
    while (true)
    {
        if (DateTime.Now.Hour >= 2 && DateTime.Now.Hour < 4)
        {
            Console.WriteLine(DateTime.Now + "____中安大巴车数据同步执行开始");
            ZakjBusDataUpdate.UpdateCarData();//中安大巴车
            Thread.Sleep(1000 * 60 * 30);
        }
        Thread.Sleep(1000);
    }
});
Thread thread6 = new Thread(threadStart6);
thread6.Start();
#endregion
#region 出租车中台车辆信息，驾驶员信息同步人车绑定关系
ParameterizedThreadStart threadStart3 = new((obj) =>
{
    Console.WriteLine(DateTime.Now + "1");
    ZtCarDataUpdate.UpdateCarData();//中台出租车
    while (true)
    {
        if (DateTime.Now.Hour >= 0 && DateTime.Now.Hour < 4)
        {
            Console.WriteLine(DateTime.Now + "____中台出租车数据同步执行开始");
            ZtCarDataUpdate.UpdateCarData();//中台出租车
            Thread.Sleep(1000 * 60 * 30);
        }
        Thread.Sleep(1000);
    }
});
Thread thread3 = new Thread(threadStart3);
thread3.Start();

ParameterizedThreadStart threadStart4 = new((obj) =>
{
    Console.WriteLine(DateTime.Now + "2");
    Thread.Sleep(2000);
    ZtCarDataUpdate.UpdateDriverData();//中台出租车的驾驶员
    while (true)
    {
        if (DateTime.Now.Hour >= 0 && DateTime.Now.Hour < 4)
        {
            Console.WriteLine(DateTime.Now + "____中台出租车驾驶员数据同步执行开始");
            ZtCarDataUpdate.UpdateDriverData();//中台出租车的驾驶员
            Thread.Sleep(1000 * 60 * 30);
        }
        Thread.Sleep(1000);
    }
});
Thread thread4 = new Thread(threadStart4);
thread4.Start();

ParameterizedThreadStart threadStart5 = new((obj) =>
{
    Console.WriteLine(DateTime.Now + "3");
    Thread.Sleep(2000);
    ZtCarDataUpdate.UpdateCarDriverData();//中台出租车驾驶员排班
    while (true)
    {
        if (DateTime.Now.Hour >= 0 && DateTime.Now.Hour < 4)
        {
            Console.WriteLine(DateTime.Now + "____中台出租车驾驶员__排班__数据同步执行开始");
            ZtCarDataUpdate.UpdateCarDriverData();//中台出租车驾驶员排班 
            Thread.Sleep(1000 * 60 * 30);
        }
        Thread.Sleep(1000);
    }
});
Thread thread5 = new Thread(threadStart5);
thread5.Start();
#endregion
#region 大巴车中台车辆信息数据同步

ParameterizedThreadStart threadStart7 = new((obj) =>
{
    Console.WriteLine(DateTime.Now + "4");
    Thread.Sleep(2000);
    ZtCarDataUpdate.ZtBusLeaseRecordData();//中台大巴车租赁数据
    while (true)
    {
        if (DateTime.Now.Hour >= 0 && DateTime.Now.Hour < 4)
        {
            Console.WriteLine(DateTime.Now + "____中台大巴车租赁数据同步执行开始");
            ZtCarDataUpdate.ZtBusLeaseRecordData();//中台大巴车租赁数据
            Thread.Sleep(1000 * 60 * 30);
        }
        Thread.Sleep(1000);
    }
});
Thread thread7 = new Thread(threadStart7);
thread7.Start();
#endregion
#region 角色车辆缓存到Redis

ParameterizedThreadStart threadStart8 = new((obj) =>
{ 
    ZtCarDataUpdate.RoleVehicleData();//角色车辆数据缓存到Redis
    while (true)
    {
        if (DateTime.Now.Hour == 5 && DateTime.Now.Minute == 4)
        {
            Console.WriteLine(DateTime.Now + "____角色车辆数据缓存到Redis");
            ZtCarDataUpdate.RoleVehicleData();//角色车辆数据缓存到Redis
            Thread.Sleep(1000 * 60 * 30);
        }
        Thread.Sleep(1000);
    }
});
Thread thread8 = new Thread(threadStart8);
thread8.Start();
#endregion
while (true)
{
    Thread.Sleep(1000 * 60);
}